import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface GetHint_ {
  /**
   * @description 根据指标名称提示模糊筛选
   */
  derivedCnName?: string;
}
export interface GetLevelBloodById_ {
  /**
   * @description 派生指标 id
   */
  id: number;
}
export interface GetList_ {
  /**
   * @description 搜索条件
   */
  content?: string;
  /**
   * @description 排序顺序,可选的值1:asc、2:desc，默认2。
   * @format int32
   */
  order?: number;
  /**
   * @description 页数
   * @format int32
   */
  pageNum?: number;
  /**
   * @description 条数
   * @format int32
   */
  pageSize?: number;
  /**
   * @description 排序条件,可选的值 默认pageViewCount,derivedCnName,id,techOwner,businessOwner,createTime,dimensionName,subType
   */
  sortBy?: string;
  /**
   * @description 基础/衍生类型
   * @format int32
   */
  subType?: number;
  /**
   * @description 主题id
   * @format int32
   */
  subjectId?: number;
}
export interface GetModelById_ {
  /**
   * @description 派生指标 id
   */
  id: number;
}
export interface GetById_ {
  /**
   * @description 指标审核状态
   */
  reviewStatus?: string;
  /**
   * @description 指标id
   * @format int32
   */
  id: number;
}

export class DerivedMetricsLibrary {
  /**
   * 根据指标名称提示查询
   *
   * @tags 派生指标库controller
   * @request GET: /derived-metrics-library/hint
   * @secure
   */
  getHint = (query: { derivedCnName?: string } | GetHint_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListDerivedMetricsLibrarySearchByNameVO>({
      url: `/derived-metrics-library/hint`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 指标血缘
   *
   * @tags 派生指标库controller
   * @request GET: /derived-metrics-library/level-blood/{id}
   * @secure
   */
  getLevelBloodById = ({ id }: { id: number } | GetLevelBloodById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityMetricsBloodVO>({
      url: `/derived-metrics-library/level-blood/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 指标列表展示/指标id名称查询/根据主题查询/可选排序
   *
   * @tags 派生指标库controller
   * @request GET: /derived-metrics-library/list
   * @deprecated
   * @secure
   */
  getList = (
    query:
      | {
          content?: string;
          order?: number;
          pageNum?: number;
          pageSize?: number;
          sortBy?: string;
          subType?: number;
          subjectId?: number;
        }
      | GetList_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityPageInfoDerivedMetricsLibraryShowVO>({
      url: `/derived-metrics-library/list`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 绑定模型
   *
   * @tags 派生指标库controller
   * @request GET: /derived-metrics-library/model/{id}
   * @deprecated
   * @secure
   */
  getModelById = ({ id }: { id: number } | GetModelById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListBindModelVO>({
      url: `/derived-metrics-library/model/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 根据指标id详情展示
   *
   * @tags 派生指标库controller
   * @request GET: /derived-metrics-library/{id}
   * @secure
   */
  getById = ({ id, ...query }: { reviewStatus?: string; id: number } | GetById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityDerivedMetricsLibraryDetailsVO>({
      url: `/derived-metrics-library/${id}`,
      method: "GET",
      params: query,
      ...params,
    });
}

export default new DerivedMetricsLibrary();
